Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Add -mfix-imm48 option #32

Open
wants to merge 1 commit into
base: nanomips
Choose a base branch
from
Open

Conversation

draganmladjenovic
Copy link

Needs tests

llvm/lib/Target/Mips/MipsAsmPrinter.cpp Outdated Show resolved Hide resolved
Comment on lines 277 to 288
auto ImmValueNeedsImm48Fix = [MI](int64_t Value) -> bool {
if ((MI->getOpcode() == Mips::Li_NM) &&
(isUInt<16>(Value) || isInt<9>(Value) || ((Value && 0xfffu) == 0u)))
return false;
return ((Value & (1u << 9)) == (1u << 9)) ||
((Value & (7u << 8)) == (1u << 8)) ||
(Value & 0x64005001u) == (0x24005001u);
};

if (!ImmValueNeedsImm48Fix(Value))
return false;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single use of lambda, would be better to just use directly?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or I guess a static function for factoring out the logic of the code is even better.

llvm/lib/Target/Mips/MipsAsmPrinter.cpp Outdated Show resolved Hide resolved
llvm/lib/Target/Mips/MipsAsmPrinter.cpp Outdated Show resolved Hide resolved
llvm/lib/Target/Mips/MipsAsmPrinter.cpp Outdated Show resolved Hide resolved
@djtodoro
Copy link
Collaborator

djtodoro commented Jun 4, 2024

@draganmladjenovic @cme can we merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants